package com.zyh.day02

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object MakeRddTest {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf()
      .setMaster("local[*]")
      .setAppName("makeRDd")
    val sc = new SparkContext(conf)

    val list = List(1, 2, 3, 4, 5)
    val rdd1: RDD[Int] = sc.parallelize(list, 4)//和executor数一样
    //sc.makeRDD(list,4)

    println(rdd1.getNumPartitions)

    val result: Array[Int] = rdd1.collect()
    result.foreach(println)

    sc.stop()
  }
}
